﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections;

namespace Polymod.Silverlight.TestHarness
{
    public partial class MainPage : UserControl
    {
        private IModel<Order> _datacontext;

        public MainPage()
        {
            InitializeComponent();
            var order = new Order("Bill", "123");
            order.Items.Add(new OrderItem("12", 40));

            _datacontext = ModelFactory.Factory.GetModel(order);
            this.DataContext = _datacontext;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            _datacontext.GetCollection(m => m.Items).Add(new OrderItem("123", 1));
        }
    }
}
